<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" th:href="@{/adminLTE/bower_components/bootstrap/dist/css/bootstrap.min.css}">
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/adminLTE/bower_components/font-awesome/css/font-awesome.min.css}">
    <!-- Ionicons -->
    <link rel="stylesheet" th:href="@{/adminLTE/bower_components/Ionicons/css/ionicons.min.css}">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/adminLTE/dist/css/AdminLTE.min.css}">
    <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
          page. However, you can choose any other skin. Make sure you
          apply the skin class to the body tag so the changes take effect. -->
    <link rel="stylesheet" th:href="@{/adminLTE/dist/css/skins/skin-blue.min.css}">

    <link rel="stylesheet" th:href="@{/bootstrap-table/bootstrap-table.css}">

    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>

    <title>标椎地名地址管理系统</title>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <div th:replace="common/header :: header"></div>

    <div th:replace="common/menu :: menu"></div>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper" >
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                Page Header
                <small>Optional description</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>门牌审批管理</a></li>
                <li class="active">门牌审批</li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content container-fluid">
            <!--<div class="row">-->
            <!--<div class="box box-info">-->
            <!--<table id="dataTable" class="table table-hover table-responsive" style="table-layout: fixed"></table>-->
            <!--</div>-->
            <!--</div>-->

            <div class="row">
                <div class="col-xs-12">
                    <div class="box box-info">
                        <div class="box-body">
                            <div id="toolbar">
                                <div class="form-inline" role="form">
                                    <div class="form-group">
                                        <label for="keyword">Keyword: </label>
                                        <input name="keyword" class="form-control" type="text" id="keyword">
                                    </div>
                                    <button id="searchBtn" type="submit" class="btn btn-primary" style="margin-left: 5px">查询</button>
                                    <!--<button id="deleteBtn" type="submit" class="btn btn-danger">删除</button>-->
                                </div>
                            </div>
                            <table id="dataTable" class="table table-hover table-responsive"
                                   style="table-layout: fixed"></table>
                        </div>
                    </div>
                </div>
            </div>


        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <div th:replace="common/footer :: footer"></div>



</div>
<!-- ./wrapper -->

<!-- REQUIRED JS SCRIPTS -->

<!-- jQuery 3 -->
<script th:src="@{/adminLTE/bower_components/jquery/dist/jquery.min.js}"></script>
<!-- Bootstrap 3.3.7 -->
<script th:src="@{/adminLTE/bower_components/bootstrap/dist/js/bootstrap.min.js}"></script>

<script th:src="@{/adminLTE/bower_components/fastclick/lib/fastclick.js}"></script>

<!-- AdminLTE App -->
<script th:src="@{/adminLTE/dist/js/adminlte.min.js}"></script>

<script th:src="@{/adminLTE/dist/js/demo.js}"></script>

<!--<script th:src="@{/js/jquery-3.4.1.min.js}"></script>-->

<script th:src="@{/bootstrap-table/bootstrap-table.min.js}"></script>
<script th:src="@{/bootstrap-table/locale/bootstrap-table-zh-CN.js}"></script>

<script th:src="@{/adminlte/bower_components/layer-v3.1.1/layer/layer.js}"></script>

<script>

    $(document).ready(function () {
        $('#dataTable').bootstrapTable({
            method: 'get',
            url: "/Admin/api/search",
            dataField: "admins",
            pageNumber: 1,
            pagination: true,
            queryParamsType: 'limit',
            queryParams: queryParams,
            sidePagination: 'server',
            pageSize: 10,
            pageList: [10, 20, 50, 100],
            // search: true,
            showRefresh: false,
            clickToSelect: true,
            toolbarAlign: 'left',
            buttonsAlign: 'right',
            toolbar: '#toolbar',
            showColumns: true,
            columns: [
                {
                    title: '全选',
                    field: 'select',
                    checkbox: true,
                    width: 25,
                    align: 'center',
                },
                {
                    title: 'ID',
                    field: 'adminId',
                    visible: false,
                    width: 160
                },

                {
                    title: 'AdminName',
                    field: 'adminName',
                    width: 160,
                    align: 'center'
                },
            ],
            locale: 'zh-CN',
            responseHandler: function (data) {
                return data;
            }
        });

        function queryParams(params) {
            return {
                pageSize: params.limit,
                pageNum: params.offset / params.limit + 1,
                keyword: $('#keyword').val()
            }
        }

        // $("#deleteBtn").click(function () {
        //     var selects = $('#dataTable').bootstrapTable('getSelections');
        //     console.log(selects);
        //     //var str = JSON.stringify(selects);
        //     layer.confirm("确定删除吗", {icon: 3, title: "提示"}, function (index) {
        //         for (var i = 0; i < selects.length; i++) {
        //             //alert(selects[i].adminId);
        //             $.ajax({
        //                 url: "/Admin/delete?id=" + selects[i].ID,
        //                 method: "delete",
        //                 success: function (data) {
        //                     if (data == true) {
        //                         // $(elem).parent().parent().remove()
        //                         layer.msg("操作成功", {time: 700}, function () {
        //                             $('.selected').remove();
        //                             console.log("成功")
        //                         });
        //                     } else {
        //                         console.log("失败");
        //                     }
        //                 },
        //                 fail: function (data) {
        //                     console.log(data);
        //                 }
        //             })
        //         }
        //     });
        // });

        $("#searchBtn").click(function () {
            var input = $('#keyword').val()
            $('#dataTable').bootstrapTable('refresh', {
                url: "/Admin/api/searchLink?keywords="
            });
        });
    })

</script>

</body>
</html>